

<template>
  <div class="app-container">
    <div id="divSearch" ref="divSearch">
      <el-form :inline="true" :model="Search" class="demo-form-inline">
        <el-form-item label="日期" prop="Search">
          <el-date-picker
            v-model="Search.CreatedOn"
            type="daterange"
            start-placeholder="开始日期"
            value-format="yyyy-MM-dd HH:mm:ss"
            end-placeholder="结束日期"
            :default-time="['00:00:00', '00:00:00']"
          />
        </el-form-item>
        <el-form-item label="编号" prop="Search">
          <el-input v-model.trim="Search.ServerCode" placeholder="编号" />
        </el-form-item>
        <el-form-item>
          <el-button type="primary" icon="el-icon-search" size="mini" @click="getDataList">查询</el-button>
          <el-button
            type="warning"
            icon="el-icon-circle-plus-outline"
            @click="FunRecommendCostRecordAdd"
            size="mini"
          >添加</el-button>
        </el-form-item>
      </el-form>
    </div>

    <el-table
      :data="DataList"
      :height="tableHeight"
      style="width: 100%;margin-top: 10px;"
      border
      @selection-change="handleSelectionChange"
      @sort-change="sortChange"
    >
      <el-table-column type="selection" label="选择" align="center" width="55"></el-table-column>
      <el-table-column align="center" width="150" label="编号">
        <template slot-scope="scope">{{ scope.row.RecommendCostRecordNo }}</template>
      </el-table-column>

      <el-table-column align="center" label="推荐人信息">
        <el-table-column align="center" label="部门">
          <template slot-scope="scope">{{ scope.row.Organizename }}</template>
        </el-table-column>

        <el-table-column align="center" label="职位">
          <template slot-scope="scope">{{ scope.row.JobName }}</template>
        </el-table-column>

        <el-table-column align="center" label="工号">
          <template slot-scope="scope">{{ scope.row.UserCode }}</template>
        </el-table-column>

        <el-table-column align="center" label="姓名">
          <template slot-scope="scope">{{ scope.row.UserName }}</template>
        </el-table-column>

        <el-table-column align="center" label="联系电话">
          <template slot-scope="scope">{{ scope.row.Tell }}</template>
        </el-table-column>

        <el-table-column align="center" label="家庭住址">
          <template slot-scope="scope">{{ scope.row.Address }}</template>
        </el-table-column>
      </el-table-column>

      <el-table-column align="center" label="推荐人信息">
        <el-table-column align="center" label="姓名">
          <template slot-scope="scope">{{ scope.row.RecommendUserName}}</template>
        </el-table-column>

        <el-table-column align="center" label="性别">
          <template slot-scope="scope">{{ scope.row.RecommendSex }}</template>
        </el-table-column>

        <el-table-column align="center" label="应聘单位">
          <template slot-scope="scope">{{ scope.row.RecommendNunit }}</template>
        </el-table-column>

        <el-table-column align="center" label="出生年月">
          <template slot-scope="scope">{{ scope.row.RecommendBirthDate }}</template>
        </el-table-column>

        <el-table-column align="center" label="民族民族">
          <template slot-scope="scope">{{ scope.row.RecommendNation }}</template>
        </el-table-column>

        <el-table-column align="center" label="籍贯">
          <template slot-scope="scope">{{ scope.row.RecommendNativePlace }}</template>
        </el-table-column>
      </el-table-column>

      <el-table-column align="header-center" label="创建人">
        <template slot-scope="scope">{{ scope.row.CreatedByName }}</template>
      </el-table-column>
      <el-table-column align="header-center" label="创建时间">
        <template slot-scope="scope">{{ scope.row.CreatedOn }}</template>
      </el-table-column>
      <el-table-column align="header-center" label="修改人">
        <template slot-scope="scope">{{ scope.row.ModifiedByName }}</template>
      </el-table-column>
      <el-table-column align="header-center" label="修改时间">
        <template slot-scope="scope">{{ scope.row.ModifyedOn }}</template>
      </el-table-column>
      <!-- <el-table-column align="center" fixed="right" width="150" label="操作">
        <template slot-scope="scope">
        	<el-button type="primary" icon="el-icon-edit" @click="handleEdit(scope)" circle></el-button>
				   <el-button type="danger" icon="el-icon-delete" @click="handleDelete(scope)"  circle></el-button>
        </template>
      </el-table-column>-->
    </el-table>
    <el-pagination
      background
      layout="sizes, prev, pager, next,total"
      :page-size="Search.pageSize"
      :total="Search.total"
      @current-change="pageChange"
    />
  </div>
</template>

<script>
import path from "path";
import { deepClone } from "@/utils";
import {
  getDataList,
  updateForm,
  DeleteForm,
} from "@/api/RecommendCostRecordForm";

// 默认的编辑字段
const defaultObject = {};

export default {
  name: "DataList",
  props: {
    ParmType: String,
    required: true,
  },
  data() {
    return {
      tableHeight: (() =>
        document.documentElement.clientHeight > 368 ? 300 : 368)(),
      RecommendCostRecordForm: "",
      inputName: "",
      EditObj: [],
      multipleTable: [],
      DataListCost: [],
      DataList: [], //队列的列表 在el-table中用
      dialogVisible: false,
      Search: {
        // 查询条件
        total: 0, // 总记录数
        pageSize: 10, // 一页显示的记录数
        page: 1, // /当前页码
        RNO: "002", // 表编号  根据Controller中对应的表编号
        jsWhere: "", // 自定义条件
      },
    };
  },
  computed: {
    routesData() {
      return this.routes;
    },
  },
  created() {
    // Mock: get all routes and roles list from server

    this.getDataList();
  },
  methods: {
    pageChange(page) {
      // 翻页
      this.Search.page = page;

      this.getDataList();
    },
    async getDataList() {
      // 获取列表数据，通用
      const res = await getDataList({ data: JSON.stringify(this.Search) });

      this.DataList = res.data.Table; //将data 中的数据放到DataList中
      this.Search.total = res.data.Table1[0].RecordCount;
      
    },
    sortChange: function (column) {
      // column, prop, order,排序，通用
      
      this.Search.sort = column.prop + " " + column.order;

      this.getDataList();
    },
    handleSelectionChange(val) {
      this.multipleTable = val;
    },

    FunRecommendCostRecordAdd() {
      this.$emit(
        "FunRecommendCostRecordAdd",
        this.multipleTable,
        this.ParmType
      );
    },
  },
};
</script>

<style lang="scss" scoped>
.app-container {
  .EditObjs-table {
    margin-top: 30px;
  }

  .permission-tree {
    margin-bottom: 5px;
  }
}
</style>
